Hello, I am new to Doors and DXL and use it now for 3 weeks. I have to write a GUI for selecting specific Objects in one Module and write theirs attributes to an file.
Object myO
Module m = read ("xYz", false)
DB listShow = null
DBE headingList = null
DBE selectButton = null
/****************************************************
Count all Object for StringArray
*****************************************************/
int noOfObj = 0
for myO in current Module do
{
noOfObj++
}
string headingArray[noOfObj]
/****************************************************
onclick of selectbutton
*****************************************************/
void on_selectButton(DBE bx)
{
for s in headingList do{
string sArray = headingArray[s]
Buffer buffContain = create()
buffContain = sArray
for myO in current Module do
{
int indexX = 0
string sNumber = number(myO)
indexX = contains(buffContain, '~' ,0)
if (sNumber == sArray[0:indexX])
{
/**************************************
a lot of IfTTT and stream outs
**************************************/
}
}
}
}
/****************************************************
build up the StringArray for multiselectlist
*****************************************************/
int n = 0
for myO in current Module do
{
string sHeading= myO."Object Heading"
sHeading= number(myO) "~" sHeading
headingArray[n++] = sHeading
}
/****************************************************
build up multiselectlist
*****************************************************/
listShow = create "Liste"
selectButton = button(listShow,"Auswhal",on_selectButton)
headingList = listView(listShow, listViewOptionMultiselect, 300, 10, headingArray)
realize listShow
insertColumn (headingList,0,"List",100,iconAuthenticatingUser)
setSize(listShow,390,500)
show listShow
close m
1. Can I only use "listViewOptionMultiselect" with string Arrays?
If I could use skiplist I would not need to count all objects in modul.
2. Is there a way to get a second column in the list?
3. With this 3 for loops it took so long, can you show me a more practical way to do?
mafo - Thu Mar 30 04:06:57 EDT 2017 |
Re: Multiselect List Wrote as a basis for my future development needs this example for you, hope it helps. Note that I am using a skip list to store the data and using a dummy array (which is not used at all) to create the listView
|
Re: Multiselect List Is it faster to iterate though an skiplist as through a modul?
How can I measure which is faster. If I try to measure I only get Sec, and so both are 3 sec
Date d = null
int currentTime = null
int start = null
d = today
start = intOf(d)
/*...
put your code here
...*/
d = today
currentTime = intOf(d)
print (currentTime - start) "s \n"
|
Re: Multiselect List mafo - Thu Mar 30 07:32:32 EDT 2017 Is it faster to iterate though an skiplist as through a modul?
How can I measure which is faster. If I try to measure I only get Sec, and so both are 3 sec
Date d = null
int currentTime = null
int start = null
d = today
start = intOf(d)
/*...
put your code here
...*/
d = today
currentTime = intOf(d)
print (currentTime - start) "s \n"
Skip is probably much faster. You can measure milliseconds using the getTickCount_() perm. If you care about measuring microseconds (e.g. profiling fast operations like skip find), you need to resort to repeating an operation and dividing by the number of milliseconds. For some inspiration see the profiling inside the DXL Standard Library Template: https://github.com/domoran/dxlstdlib/blob/master/lib/test/profiler.inc and for profiling examples: https://github.com/domoran/dxlstdlib/tree/master/profiles Hope that helps, regards, Mathias |